<?php

declare(strict_types=1);

/**
 * @Author:     Frank
 * @contact     frank_hhm@163.com
 * @Date:       2023-01-12 13:14:56
 * @Last Modified time: 2023-01-13 11:27:32
 */

namespace app\common\model\wechat;

use frank\base\BaseModel;
use frank\traits\ModelTrait;

/**
 * 用户微信
 * Class  UserModel
 * @package app\common\model\wechat
 */
class UserModel extends BaseModel
{
    use ModelTrait;

    /**
     * 数据表主键
     */
    protected $pk = 'id';

    /**
     * 模型名称
     */
    protected $name = 'wechat_user';


    /**
     * WeappOpenid搜索器
     */
    public function searchWeappOpenidAttr($query, $value)
    {
        if(!empty($value)){
            $query->where('weapp_openid', $value);
        }
    }

    /**
     * unionid搜索器
     */
    public function searchUnionidAttr($query, $value)
    {
        if(!empty($value)){
            $query->where('unionid', $value);
        }
    }

}